package models

// 将指定类型指定到对应的数据表（最少需要绑定一次并且注册）

type News struct {
	Id           int    `orm:"auto"`
	Catid        int    `orm:"size(11)"`
	Title        string `orm:"size(255)"` //varchar(255)
	Thumb        string
	Keywords     string
	Description  string
	Hits         int `orm:"default(0)"`
	Uid          int `orm:"index"` //index,unique
	Author       string
	Status       int `orm:"default(1)" description:"这是状态字段"`
	Url          string
	LinkId       int `orm:"column(link_id)"`
	Tableid      uint
	Inputip      string
	Inputtime    int64
	Updatetime   int64
	Displayorder int
}

func (u *News) TableName() string {
	return "hz_1_news"
}

// 多字段索引

func (u *News) TableIndex() [][]string {
	return [][]string{
		[]string{"id", "Uid", "Catid", "LinkId", "Status", "Updatetime", "Hits", "Displayorder"},
	}
}

// 多字段唯一键

func (u *News) TableUnique() [][]string {
	return [][]string{
		[]string{"Catid", "Status"},
	}
}

func (u *News) TableEngine() string {
	return "INNODB"
}
